cssjshtml vue-echart 点击跳转传参和接收

葫芦的运维日志

下一篇 搜索 上一篇

浏览量 3784

2019/03/05 17:09


1.vue-echart  点击跳转通过路由传参。

<template>
  <div :style="{height: height + 'px'}">
    <IEcharts :option="line_option" :loading="loading" @ready="onReady" @click="onClick"></IEcharts>
  </div>
</template>

    methods: {
      onClick(event, instance, ECharts) {
        let date = new Date(event.name.slice(0, 4) + '/' + event.name.slice(4, 6) + '/' + event.name.slice(6, 8))
        let starttime = date
        let endtime = new Date(date.getTime() + 24 * 60 * 60 * 1000)

        this.$router.push({
          path: "Detail",
          name: "告警详情",
          params: {
            timevalue: [starttime, endtime]
          }
        })
      }
}

2.跳转页面参数接收:

created: function () {
  
if (this.$route.params.timevalue) {
this.timevalue = this.$route.params.timevalue
console.log(this.timevalue)
}
}

 

葫芦的运维日志

打赏

上一篇 搜索 下一篇
© 冰糖葫芦甜(bthlt.com) 2021 王梓打赏联系方式 陕ICP备17005322号-1